error.js ➔ toString   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
dl 0
loc 3
rs 10
nop 0
1
function APIError(code, message, body) {
2
    this.code = code;
3
    this.message = (message || '');
4
    this.body = body;
5
}
6
7
Object.setPrototypeOf(APIError.prototype, Error.prototype);
8
APIError.prototype.name = 'APIError';
9
APIError.prototype.toString = function toString() {
10
    return this.message ? this.code + ' - ' + this.message : String(this.code);
11
};
12
13
export default APIError;